package com.mask.sca.system.controller;

import com.mask.sca.system.entity.Log;
import com.mask.sca.system.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/system/log")
public class LogController {
    @Autowired
    private LogService logService;

    @GetMapping("/list")
    public List<Log> list() {
        return logService.list();
    }

    @GetMapping("/{id}")
    public Log get(@PathVariable Long id) {
        return logService.getById(id);
    }

    @PostMapping("/add")
    public boolean add(@RequestBody Log log) {
        return logService.save(log);
    }

    @PutMapping("/update")
    public boolean update(@RequestBody Log log) {
        return logService.updateById(log);
    }

    @DeleteMapping("/delete/{id}")
    public boolean delete(@PathVariable Long id) {
        return logService.removeById(id);
    }
} 